/*
 ------------------------------------------------------------------------------
 Copyright (C) 2009-2011 Eternal Games.

 This file is part of the Eternal Tech source code.

 The Eternal Tech source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Eternal Tech source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Eternal Tech source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// editor.h - Integrated editors interface
//


#if !defined(__EDITOR_H__) || !INCLUDE_GUARDS
#define __EDITOR_H__


/*
 ==============================================================================

 Integrated Editors Interface:

 Integrated editors allow real time editing of certain aspects of the game,
 such as light or speaker entities.

 This interface allows the user to interact with an editor, as well as allowing
 the editor to refresh itself every frame.

 Note that only one editor can be active at a time.

 ==============================================================================
*/

struct editorCallbacks_t {
	// Called by LaunchEditor to create the window for the active editor.
	// Should return the handle of the created window, or NULL if an error
	// occurred.
	void					*(*createWindow)();

	// Called by CloseEditor to destroy the window for the active editor
	void					(*destroyWindow)();

	// Called by the client system for left mouse button down events to let the
	// active editor select an entity for editing.
	// Should return true if the client system should skip generating game
	// commands for said event.
	// This function can be NULL if the active editor doesn't need to select
	// entities.
	bool					(*mouseEvent)();

	// Called by the renderer every frame after drawing the primary view to let
	// the active editor draw all editable entities.
	// This function can be NULL if the active editor doesn't need to draw
	// entities.
	void					(*draw)();
};

// Launches an integrated editor
bool			ED_LaunchEditor (const char *name, editorCallbacks_t *callbacks);

// Closes the currently active integrated editor
void			ED_CloseEditor ();

// Returns true if an integrated editor is currently active
bool			ED_IsEditorActive ();

// Enumerates material scripts using a callback
void			ED_EnumMaterialDefs (void (*callback)(const char *name));

// Called by the client system for left mouse button down events.
// Will perform a callback to let the active editor select an entity for
// editing. The callback function should return true if it wants the client
// system to skip generating game commands for said event.
bool			ED_MouseEvent ();

// Called by the renderer every frame after drawing the primary view.
// Will perform a callback to let the active editor draw all editable entities.
void			ED_Draw ();

// Drawing functions
void			ED_DrawBox (const vec3_t corners[8], const vec3_t color);


#else
FILE_WARNING
#endif   // __EDITOR_H__